﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdSiRecursiveVisitor : OdSiVisitor
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdSiRecursiveVisitor(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdSiRecursiveVisitor_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdSiRecursiveVisitor obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdSiRecursiveVisitor()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdSiRecursiveVisitor(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public OdSiShape query()
		{
			OdSiShapeImpl result = new OdSiShapeImpl(GlobalsPINVOKE.OdSiRecursiveVisitor_query(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void resetQuery(OdSiShape pQuery)
		{
			GlobalsPINVOKE.OdSiRecursiveVisitor_resetQuery(this.swigCPtr, pQuery.GetCPtr());
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeMatrix3d worldToNode()
		{
			IntPtr intPtr = GlobalsPINVOKE.OdSiRecursiveVisitor_worldToNode(this.swigCPtr);
			OdGeMatrix3d result = (intPtr == IntPtr.Zero) ? null : new OdGeMatrix3d(intPtr, false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setWorldToNode(OdGeMatrix3d tf)
		{
			GlobalsPINVOKE.OdSiRecursiveVisitor_setWorldToNode(this.swigCPtr, OdGeMatrix3d.getCPtr(tf));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeMatrix3d nodeToWorld()
		{
			IntPtr intPtr = GlobalsPINVOKE.OdSiRecursiveVisitor_nodeToWorld(this.swigCPtr);
			OdGeMatrix3d result = (intPtr == IntPtr.Zero) ? null : new OdGeMatrix3d(intPtr, false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setNodeToWorld(OdGeMatrix3d tf)
		{
			GlobalsPINVOKE.OdSiRecursiveVisitor_setNodeToWorld(this.swigCPtr, OdGeMatrix3d.getCPtr(tf));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeMatrix3d worldToModel()
		{
			IntPtr intPtr = GlobalsPINVOKE.OdSiRecursiveVisitor_worldToModel(this.swigCPtr);
			OdGeMatrix3d result = (intPtr == IntPtr.Zero) ? null : new OdGeMatrix3d(intPtr, false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setWorldToModel(OdGeMatrix3d tf)
		{
			GlobalsPINVOKE.OdSiRecursiveVisitor_setWorldToModel(this.swigCPtr, OdGeMatrix3d.getCPtr(tf));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeMatrix3d modelToWorld()
		{
			IntPtr intPtr = GlobalsPINVOKE.OdSiRecursiveVisitor_modelToWorld(this.swigCPtr);
			OdGeMatrix3d result = (intPtr == IntPtr.Zero) ? null : new OdGeMatrix3d(intPtr, false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setModelToWorld(OdGeMatrix3d tf)
		{
			GlobalsPINVOKE.OdSiRecursiveVisitor_setModelToWorld(this.swigCPtr, OdGeMatrix3d.getCPtr(tf));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
